import java.util.Stack;

public class Test {
    public static void main(String[] args) {
        Stack<Integer> data = new Stack<Integer>();
        data.push(1);
        data.push(2);
        data.push(3);
        data.push(4);
        //pop()出栈顶元素4，然后栈顶元素变成3
        System.out.println(data.pop());//---->4
        //peek()获取栈顶元素不出栈----3
        System.out.println(data.peek());//----->3
        //size()获取有效元素个数
        System.out.println(data.size());//----->3
    }


}
